#include <iostream>
#include <set>
using namespace std;
int num[100][2];
int find(int front, int rear, int air)
{
    int mid;
    while (front <= rear)
    {
        mid = (front + rear) / 2;
        if (num[mid][1] < air)
            front = mid + 1;
        else if (num[mid][1] > air)
            rear = mid - 1;
        else if (num[mid][1] == air)
            return mid;
    }
    return -1;
}
void sortFun(int front, int rear)
{
    if (front >= rear)
        return;
    int i = front, j = rear, l = num[front][0], k = num[front][1];
    while (i < j)
    {
        while (i < j && num[j][1] >= k)
            j--;
        if (i < j)
        {
            num[i][0] = num[j][0];
            num[i++][1] = num[j][1];
        }
        while (i < j && num[i][1] < k)
            i++;
        if (i < j)
        {
            num[j][0] = num[i][0];
            num[j--][1] = num[i][1];
        }
    }
    num[i][0] = l;
    num[i][1] = k;
    sortFun(front, i - 1);
    sortFun(i + 1, rear);
}
int main()
{
    int a, b, c, n, k, m = 9999;
    set<int> st;
    cin >> n;
    num[0][0] = 0;
    cin >> num[0][1];
    st.insert(0);
    for (int i = 1; i < n; i++)
    {
        st.insert(i);
        num[i][0] = i;
        cin >> num[i][1];
    }
    sortFun(0, n - 1);
    cin >> k;
    while (st.size())
    {
        // for (auto val : st)
        //     cout << val << " ";
        // cout << endl;
        int air = find(0, n - 1, k - num[*st.begin()][1]);
        if (air != -1)
        {
            c = air + num[*st.begin()][0];
            cout<<c<<"=="<<m<<endl;
            if (c <= m)
            {
                a = min(air, num[*st.begin()][0]);
                b = max(air, num[*st.begin()][0]);
            }
            // cout<<num[*st.begin()][1]<<" "<<num[*st.find(air)][1]<<endl;
            st.erase(st.begin());
            st.erase(st.find(air));
        }
        else
            st.erase(st.begin());
    }
    cout << a << " " << b << endl;
    return 0;
}